
clear 
clear matrix
set mem 2000m
set more off

sysdir set PLUS "C:\ado\plus"
global	curr "YOUR DIRECTORY"
cd "$curr"

use "$curr\VXDATA", clear

replace nIPO=. if nIPO<2

drop n_deals n_unique_deals vc_wave
rename n_deals2 n_deals
rename n_deals3 n_unique_deals
rename vc_wave1 vc_wave

keep Company_Nation sic2 year n_deals1 n_deals n_unique_deals n_MA_SDC total_value_SDC nobsWS RD_SALE RD_TA fipo_wave fma_wave fvc_wave  ipo_wave ma_wave medInv medMB nIPO n_MA_SDC totalCAPEX totalRD totalSALE totalTA vc_wave

sort Company_Nation sic2 year 
by Company_Nation sic2: gen ln_deals = n_deals[_n-1]
by Company_Nation sic2: gen ln_MA_SDC =  n_MA_SDC[_n-1]
by Company_Nation sic2: gen ltotal_value_SDC =  total_value_SDC[_n-1]
by Company_Nation sic2: gen lu_deals =  n_unique_deals[_n-1]
by Company_Nation sic2: gen lmedInv =  medInv[_n-1]
by Company_Nation sic2: gen lmedMB =  medMB[_n-1]
by Company_Nation sic2: gen ltotalCAPEX =  totalCAPEX[_n-1]
by Company_Nation sic2: gen lvc_wave =  vc_wave[_n-1]
by Company_Nation sic2: gen lma_wave =  ma_wave[_n-1]
by Company_Nation sic2: gen lfvc_wave =  fvc_wave[_n-1]
by Company_Nation sic2: gen lfma_wave =  fma_wave[_n-1]

by Company_Nation sic2: gen lnIPO = nIPO[_n-1]
by Company_Nation sic2: gen lipo_wave =  ipo_wave[_n-1]

* percentage change in # of deals in an industry
g d_nIPO=(nIPO-lnIPO)/lnIPO
g d_ndeals=(n_deals-ln_deals)/ln_deals
* percentage change in # of unique deals in an industry
g d_nudeals=(n_unique_deals-lu_deals)/lu_deals

* percentage change in total deal value, but deal value is often missing
*g d_Total_Deal_Value=(Total_Deal_Value-lTotal_Deal_Value)/lTotal_Deal_Value

* percentage change in # of MA deals in an industry
g d_n_MA_SDC=(n_MA_SDC-ln_MA_SDC)/ln_MA_SDC

* percentage change in total value of MA deals in an industry, also sometimes missing
g d_total_value_SDC=(total_value_SDC-ltotal_value_SDC)/ltotal_value_SDC

sort Company_Nation sic2 year 
by Company_Nation sic2: gen ld_ndeals = d_ndeals[_n-1]
by Company_Nation sic2: gen ld_nudeals = d_nudeals[_n-1]
by Company_Nation sic2: gen ld_n_MA_SDC = d_n_MA_SDC[_n-1]
by Company_Nation sic2: gen ld_nIPO = d_nIPO[_n-1]

g one=1
bysort Company_Nation year: egen medRD = median(RD_SALE)
bysort Company_Nation year: egen p75RD = pctile(RD_SALE), p(75)
bysort Company_Nation year: egen p25RD = pctile(RD_SALE), p(25)
bysort Company_Nation year: egen p90RD = pctile(RD_SALE), p(90)

drop if n_deals1<3
drop if n_MA_SDC<3
drop if n_deals1==.
drop if n_MA_SDC==.

g RDxn_deals=RD_SALE*n_deals
g RDxn_MA_SDC=RD_SALE*n_MA_SDC
g nd_sales=n_deals/totalSALE
g nd_salesMA=n_MA_SDC/totalSALE
g RDxnd_sales=RD_SALE*nd_sales
g RDxnd_salesMA=RD_SALE*nd_salesMA
g nd_firms=n_deals/nobsWS
g nud_firms=n_unique_deals/nobsWS
g nd_firmsMA=n_MA_SDC/nobsWS
g RDxnd_firms=RD_SALE*nd_firms
g RDxnud_firms=RD_SALE*nud_firms
g RDxnd_firmsMA=RD_SALE*nd_firmsMA
g RDxd_ndeals=RD_SALE*d_ndeals
g RDxd_n_MA_SDC=RD_SALE*d_n_MA_SDC
g RDxld_n_MA_SDC=RD_SALE*ld_n_MA_SDC
g logdeals=log(n_deals)
g logudeals=log(n_unique_deals)
g logMA=log(n_MA_SDC)
g laglogMA=log(ln_MA_SDC)
g RDxlogMA=RD_SALE*logMA
g RDxlaglogMA=RD_SALE*laglogMA
g sizei=log(totalSALE)
g logRD=log(totalRD)
g logRDxlogMA=logRD*logMA
g logRDxlaglogMA=logRD*laglogMA
g logCAPEX=log(totalCAPEX)
g laglogCAPEX=log(ltotalCAPEX)
g nd_firmsIPO=nIPO/nobsWS


**** lagged 3 year average M&A *****

sort Company_Nation sic2 year 
by Company_Nation sic2: gen d_n_MA_SDC3yr = (n_MA_SDC[_n-1]-n_MA_SDC[_n-3])/n_MA_SDC[_n-3]
by Company_Nation sic2: gen logMA3yr = (logMA[_n-1]+logMA[_n-2]+logMA[_n-3])/3

label var d_n_MA_SDC3yr "lagged 3 year % change in MA deals"
label var logMA3yr "lagged 3 year average log MA deals"

g RDxd_n_MA_SDC3yr=RD_SALE*d_n_MA_SDC3yr
g logRDxlogMA3r=RD_SALE*logMA3yr
label var RDxd_n_MA_SDC3yr "Interaction R&D and lagged 3 year MA growth"
label var logRDxlogMA3r "Interaction R&D and lagged 3 year average log MA deals"


sort Company_Nation sic2 year 
by Company_Nation sic2: gen lnd_firms = nd_firms[_n-1]
by Company_Nation sic2: gen lnud_firms = nud_firms[_n-1]
by Company_Nation sic2: gen lnd_firmsMA = nd_firmsMA[_n-1]
by Company_Nation sic2: gen l2nd_firmsMA = nd_firmsMA[_n-2]
by Company_Nation sic2: gen l3nd_firmsMA = nd_firmsMA[_n-3]
by Company_Nation sic2: gen l4nd_firmsMA = nd_firmsMA[_n-4]
by Company_Nation sic2: gen l5nd_firmsMA = nd_firmsMA[_n-5]

by Company_Nation sic2: gen lnd_firmsIPO = nd_firmsIPO[_n-1]
by Company_Nation sic2: gen lnd_sales = nd_sales[_n-1]
by Company_Nation sic2: gen lnd_salesMA = nd_salesMA[_n-1]

g RDxlnd_firmsMA=RD_SALE*lnd_firmsMA
g RDxlnd_salesMA=RD_SALE*lnd_salesMA


set more off


label var nd_firmsMA "Scaled M\&A deals"
label var lnd_firmsMA "Scaled M\&A deals (t-1)"
label var l2nd_firmsMA "Scaled M\&A deals (t-2)"
label var l3nd_firmsMA "Scaled M\&A deals (t-3)"
label var l4nd_firmsMA "Scaled M\&A deals (t-4)"
label var l5nd_firmsMA "Scaled M\&A deals (t-5)"


encode Company_Nation, gen(CN)
g Country_Ind = CN*100+sic2




***************************************************************************************************************************
***************************************************************************************************************************
**** TABLE 2 *****
** correlations ***

pwcorr d_ndeals ld_ndeals d_nudeals ld_nudeals d_n_MA_SDC ld_n_MA_SDC d_nIPO ld_nIPO, sig star(.05)
mkcorr d_ndeals ld_ndeals d_nudeals ld_nudeals d_n_MA_SDC ld_n_MA_SDC d_nIPO ld_nIPO, log(test) replace sig lab cdec(3) mdec(3) 

pwcorr nd_firms lnd_firms nud_firms lnud_firms nd_firmsMA lnd_firmsMA nd_firmsIPO lnd_firmsIPO, sig star(.05)
mkcorr nd_firms lnd_firms nud_firms lnud_firms nd_firmsMA lnd_firmsMA nd_firmsIPO lnd_firmsIPO, log(test1) replace sig lab cdec(3) mdec(3) 


**** TABLE 3 *****
** lagged M&A activity ***


reghdfe nd_firmsMA   lnd_firmsMA,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2  nd_firmsMA   lnd_firmsMA     using    table1, bdec(3) rdec(3) keep(nd_firmsMA   lnd_firmsMA) tex replace label

reghdfe nd_firmsMA   l2nd_firmsMA,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2  nd_firmsMA   l2nd_firmsMA     using    table1, bdec(3) rdec(3) keep(nd_firmsMA  l2nd_firmsMA) tex append label

reghdfe nd_firmsMA   l3nd_firmsMA,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2  nd_firmsMA   l3nd_firmsMA     using    table1, bdec(3) rdec(3) keep(nd_firmsMA  l3nd_firmsMA) tex append label

reghdfe nd_firmsMA   l4nd_firmsMA,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2  nd_firmsMA   l4nd_firmsMA     using    table1, bdec(3) rdec(3) keep(nd_firmsMA  l4nd_firmsMA) tex append label

reghdfe nd_firmsMA   l5nd_firmsMA,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2  nd_firmsMA   l5nd_firmsMA     using    table1, bdec(3) rdec(3) keep(nd_firmsMA  l5nd_firmsMA) tex append label

*****************************************************************


xi: reg nd_firmsMA   lnd_firmsMA    i.Country_Ind     i.year, cluster(Country_Ind)
outreg2  nd_firmsMA   lnd_firmsMA     using    myreg2, bdec(3) rdec(3) keep(nd_firmsMA   lnd_firmsMA) tex replace label

xi: reg nd_firmsMA     l2nd_firmsMA    i.CN   i.year, cluster(Country_Ind)
outreg2  nd_firmsMA     l2nd_firmsMA   using    myreg2, bdec(3) rdec(3) keep(nd_firmsMA     l2nd_firmsMA) tex append label

xi: reg nd_firmsMA     l3nd_firmsMA    i.CN   i.year, cluster(Country_Ind)
outreg2  nd_firmsMA     l3nd_firmsMA   using    myreg2, bdec(3) rdec(3) keep(nd_firmsMA     l3nd_firmsMA) tex append label

xi: reg nd_firmsMA     l4nd_firmsMA   i.CN    i.year, cluster(Country_Ind)
outreg2  nd_firmsMA     l4nd_firmsMA   using    myreg2, bdec(3) rdec(3) keep(nd_firmsMA     l4nd_firmsMA) tex append label

xi: reg nd_firmsMA     l5nd_firmsMA    i.CN   i.year, cluster(Country_Ind)
outreg2  nd_firmsMA     l5nd_firmsMA   using    myreg2, bdec(3) rdec(3) keep(nd_firmsMA     l5nd_firmsMA) tex append label


**** TABLE 4 *****
** VC regressions ***

***PANEL A - growth in deals ****

xi: reg d_ndeals   ld_n_MA_SDC i.year, cluster(Country_Ind)
outreg2 d_ndeals   ld_n_MA_SDC using myreg2, bdec(3) rdec(3) keep (d_ndeals   ld_n_MA_SDC) tex replace label

xi: reg d_ndeals   ld_n_MA_SDC lmedInv i.year, cluster(Country_Ind)
outreg2 d_ndeals   ld_n_MA_SDC lmedInv using myreg2, bdec(3) rdec(3) keep (d_ndeals   ld_n_MA_SDC lmedInv) tex  append label

xi: reg d_ndeals   ld_n_MA_SDC lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_ndeals   ld_n_MA_SDC lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (d_ndeals   ld_n_MA_SDC lmedInv lmedMB) tex append label

xi: reg d_ndeals   ld_n_MA_SDC lmedInv lmedMB ld_nIPO i.year, cluster(Country_Ind)
outreg2 d_ndeals   ld_n_MA_SDC lmedInv lmedMB ld_nIPO using myreg2, bdec(3) rdec(3) keep (d_ndeals   ld_n_MA_SDC lmedInv ld_nIPO lmedMB) tex append label


xi: reg d_nudeals   ld_n_MA_SDC i.year, cluster(Country_Ind)
outreg2 d_nudeals   ld_n_MA_SDC using myreg2, bdec(3) rdec(3) keep (d_nudeals   ld_n_MA_SDC) tex append label

xi: reg d_nudeals   ld_n_MA_SDC lmedInv i.year, cluster(Country_Ind)
outreg2 d_nudeals   ld_n_MA_SDC lmedInv using myreg2, bdec(3) rdec(3) keep (d_nudeals   ld_n_MA_SDC lmedInv) tex append label


xi: reg d_nudeals   ld_n_MA_SDC lmedInv i.year, cluster(Country_Ind)
outreg2 d_nudeals   ld_n_MA_SDC lmedInv using myreg2, bdec(3) rdec(3) keep (d_nudeals   ld_n_MA_SDC lmedInv) tex append label


xi: reg d_nudeals   ld_n_MA_SDC lmedInv lmedMB ld_nIPO i.year, cluster(Country_Ind)
outreg2 d_nudeals   ld_n_MA_SDC lmedInv lmedMB ld_nIPO  using myreg2, bdec(3) rdec(3) keep (ld_n_MA_SDC lmedInv lmedMB ld_nIPO ) tex append label

***PANEL B - deals scaled by WS firms ****


reghdfe nd_firms   lnd_firmsMA,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms   lnd_firmsMA using myreg2, bdec(3) rdec(3) keep (nd_firms   lnd_firmsMA) tex replace label

reghdfe nd_firms   lnd_firmsMA lmedInv,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms   lnd_firmsMA lmedInv using myreg2, bdec(3) rdec(3) keep (nd_firms   lnd_firmsMA lmedInv) tex append label

reghdfe nd_firms   lnd_firmsMA lmedInv lmedMB,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms   lnd_firmsMA lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (nd_firms   lnd_firmsMA lmedInv lmedMB) tex append label

reghdfe nd_firms   lnd_firmsMA lmedInv lmedMB lnd_firmsIPO,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms   lnd_firmsMA lmedInv lmedMB lnd_firmsIPO using myreg2, bdec(3) rdec(3) keep (nd_firms lnd_firmsMA lmedInv lmedMB lnd_firmsIPO) tex append label


reghdfe nud_firms   lnd_firmsMA ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms   lnd_firmsMA using myreg2, bdec(3) rdec(3) keep (nud_firms lnd_firmsMA) tex append label

reghdfe nud_firms   lnd_firmsMA lmedInv,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms   lnd_firmsMA lmedInv using myreg2, bdec(3) rdec(3) keep (nud_firms   lnd_firmsMA lmedInv) tex append label

reghdfe nud_firms   lnd_firmsMA lmedInv lmedMB ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms   lnd_firmsMA lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (nud_firms   lnd_firmsMA lmedInv lmedMB) tex append label

reghdfe nud_firms   lnd_firmsMA lmedInv lmedMB lnd_firmsIPO ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms   lnd_firmsMA lmedInv lmedMB lnd_firmsIPO using myreg2, bdec(3) rdec(3) keep (nud_firms   lnd_firmsMA lmedInv lmedMB lnd_firmsIPO) tex append label



***** SAME BUT using 3year growth in MA ****

***PANEL C - growth in deals  ****

xi: reg d_ndeals   d_n_MA_SDC3yr i.year, cluster(Country_Ind)
outreg2 d_ndeals   d_n_MA_SDC3yr using myreg2, bdec(3) rdec(3) keep (d_ndeals   d_n_MA_SDC3yr) tex replace label

xi: reg d_ndeals   d_n_MA_SDC3yr lmedInv i.year, cluster(Country_Ind)
outreg2 d_ndeals   d_n_MA_SDC3yr lmedInv using myreg2, bdec(3) rdec(3) keep (d_ndeals   d_n_MA_SDC3yr lmedInv) tex append label

xi: reg d_ndeals   d_n_MA_SDC3yr lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_ndeals   d_n_MA_SDC3yr lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (d_ndeals   d_n_MA_SDC3yr lmedInv lmedMB) tex append label

xi: reg d_ndeals   d_n_MA_SDC3yr lmedInv lmedMB ld_nIPO i.year, cluster(Country_Ind)
outreg2 d_ndeals   d_n_MA_SDC3yr lmedInv lmedMB ld_nIPO using myreg2, bdec(3) rdec(3) keep (d_ndeals   d_n_MA_SDC3yr lmedInv lmedMB ld_nIPO) tex append label

*** unique deals, errors clustered by country-industry, year fixed effects ****;

xi: reg d_nudeals   d_n_MA_SDC3yr i.year, cluster(Country_Ind)
outreg2 d_nudeals   d_n_MA_SDC3yr using myreg2, bdec(3) rdec(3) keep (d_nudeals   d_n_MA_SDC3yr) tex append label

xi: reg d_nudeals   d_n_MA_SDC3yr lmedInv i.year, cluster(Country_Ind)
outreg2 d_nudeals   d_n_MA_SDC3yr lmedInv using myreg2, bdec(3) rdec(3) keep (d_nudeals   d_n_MA_SDC3yr lmedInv) tex append label

xi: reg d_nudeals   d_n_MA_SDC3yr lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_nudeals   d_n_MA_SDC3yr lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (d_nudeals   d_n_MA_SDC3yr lmedInv lmedMB) tex append label

xi: reg d_nudeals   d_n_MA_SDC3yr lmedInv lmedMB ld_nIPO i.year, cluster(Country_Ind)
outreg2 d_nudeals   d_n_MA_SDC3yr lmedInv lmedMB ld_nIPO using myreg2, bdec(3) rdec(3) keep (d_nudeals   d_n_MA_SDC3yr lmedInv lmedMB ld_nIPO) tex append label



**** TABLE 5 *****
***  WAVES ****

reghdfe vc_wave  lma_wave ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 vc_wave  lma_wave using myreg2, bdec(3) rdec(3) keep (vc_wave  lma_wave) replace label

reghdfe vc_wave  lma_wave lmedInv i.year,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 vc_wave  lma_wave lmedInv using myreg2, bdec(3) rdec(3) keep (vc_wave  lma_wave lmedInv) append label

reghdfe vc_wave  lma_wave lmedInv lmedMB i.year,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 vc_wave  lma_wave lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (vc_wave  lma_wave lmedInv lmedMB) append label

reghdfe vc_wave  lma_wave RD_SALE i.year,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 vc_wave  lma_wave RD_SALE using myreg2, bdec(3) rdec(3) keep (vc_wave  lma_wave RD_SALE) append label

reghdfe vc_wave  lma_wave RD_SALE RDxd_n_MA_SDC i.year,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 vc_wave  lma_wave RD_SALE RDxd_n_MA_SDC using myreg2.doc, bdec(3) rdec(3) keep (vc_wave  lma_wave RD_SALE RDxd_n_MA_SDC) append label

reghdfe vc_wave  lma_wave RD_SALE RDxld_n_MA_SDC i.year,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 vc_wave  lma_wave RD_SALE RDxld_n_MA_SDC using myreg2.doc, bdec(3) rdec(3) keep (vc_wave  lma_wave RD_SALE RDxld_n_MA_SDC) append label


****** waves - probit ****;

xi: dprobit vc_wave  lma_wave i.year i.Country_Ind, cluster(Country_Ind) 
outreg2 vc_wave  lma_wave using myreg2, bdec(3) rdec(3) keep (vc_wave  lma_wave) tex replace label

xi: dprobit vc_wave lma_wave lvc_wave  i.year i.Country_Ind, cluster(Country_Ind) 
outreg2 vc_wave lma_wave lvc_wave  using myreg2, bdec(3) rdec(3) keep (vvc_wave lma_wave lvc_wave) tex append label

xi: dprobit vc_wave lma_wave lvc_wave  lipo_wave i.year i.Country_Ind , cluster(Country_Ind) 
outreg2 vc_wave lma_wave lvc_wave  lipo_wave using myreg2, bdec(3) rdec(3) keep (vc_wave lma_wave lvc_wave  lipo_wave) tex append label

xi: dprobit vc_wave  lma_wave lmedInv i.year i.Country_Ind, cluster(Country_Ind)
outreg2 vc_wave  lma_wave lmedInv using myreg2, bdec(3) rdec(3) keep (vc_wave  lma_wave lmedInv) tex  append label

xi: dprobit vc_wave lma_wave lvc_wave  lmedInv i.year i.Country_Ind, cluster(Country_Ind)
outreg2 vc_wave lma_wave lvc_wave  lmedInv using myreg2, bdec(3) rdec(3) keep (vc_wave lma_wave lvc_wave  lmedInv) tex append label

xi: dprobit vc_wave  lma_wave lmedInv lmedMB i.year i.Country_Ind, cluster(Country_Ind)
outreg2 vc_wave  lma_wave lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (vc_wave  lma_wave lmedInv lmedMB) tex append label

xi: dprobit vc_wave lma_wave lvc_wave lmedInv lmedMB i.year i.Country_Ind, cluster(Country_Ind)
outreg2 vc_wave lma_wave lvc_wave lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (vc_wave lma_wave lvc_wave lmedInv lmedMB) tex append label

xi: dprobit vc_wave lma_wave lvc_wave lipo_wave lmedInv lmedMB i.year i.Country_Ind, cluster(Country_Ind)
outreg2 vc_wave lma_wave lvc_wave lipo_wave lmedInv lmedMB using myreg2, bdec(3) rdec(3) keep (vc_wave lma_wave lvc_wave lipo_wave lmedInv lmedMB) tex append label


***************************
** Table 6 IV regressions
***************************

clear 
clear matrix
set mem 2000m
set more off

global temp "F:\Data1\Temp"

sysdir set PLUS "C:\ado\plus"
global	curr "c:\curr"

** load dataset with VC and M&A activities aggregated by country

use "$curr\sdcvx_country2020", clear
keep Company_Nation ayear drate3
sort Company_Nation ayear
save "$curr\temp", replace

clear 
clear matrix
set mem 2000m
set more off
global temp "F:\Data1\Temp"
*sysdir set PLUS "C:\ado\plus"
sysdir set PLUS "F:\ado\plus"

**load tbill rates**

use "$curr\sdc_vx_tbill2020", clear

sort Company_Nation ayear
merge Company_Nation ayear using "$curr\temp"
drop _merge


g n_deals=n_deals_CB+n_deals_DOM
g n_udeals=n_udeals_CB+n_udeals_DOM
g n_MA_SDC=n_MA_SDC_ALL


sort Company_Nation ayear 
by Company_Nation : gen ln_deals = n_deals[_n-1]
by Company_Nation : gen lu_deals = n_udeals[_n-1]


g d_ndeals=(n_deals-ln_deals)/ln_deals
g d_nudeals=(n_udeals-lu_deals)/lu_deals
g maws=n_MA_SDC/nobsWS
g nd_firms=n_deals/nobsWS
g nud_firms=n_udeals/nobsWS

label var nd_firms "Scaled VC deals"
label var nud_firms "Scaled unique VC deals"
label var maws "Scaled M&A deals"
label var medMB "Median market-to-book"
label var medInv "Median Investment"


sort Company_Nation ayear
save temp, replace 

**load gdp growth**

use "$curr\gdp_growth", clear
rename   Country_or_Area Company_Nation
rename Year ayear
rename Value gdpgr
drop  Value_Footnotes
sort Company_Nation ayear
by Company_Nation : gen lgdpgr = gdpgr[_n-1]
save temp1, replace

use temp, clear
merge Company_Nation ayear using temp1
drop if _merge==2
drop _merge


sort Company_Nation ayear 
by Company_Nation : gen lmaws = maws[_n-1]
by Company_Nation : gen llgdpgr = lgdpgr[_n-1]
by Company_Nation : gen ldtbill = dtbill[_n-1]
by Company_Nation : gen ldrate3 = drate3[_n-1]
by Company_Nation : gen lnd_firms = nd_firms[_n-1]
encode Company_Nation, gen(CN)

ivregress 2sls nd_firms medMB medInv lgdpgr i.ayear  (lmaws =ldtbill ldrate3 lmedMB lmedInv llgdpgr), cluster(Company_Nation)
outreg2 nd_firms medMB medInv lgdpgr lmaws using ivreg, bdec(3) rdec(3) keep (nd_firms medMB medInv lgdpgr lmaws) tex replace label

ivregress 2sls nud_firms medMB medInv lgdpgr i.ayear (lmaws =ldtbill ldrate3 lmedMB lmedInv llgdpgr), cluster(Company_Nation)
outreg2 nd_firms medMB medInv lgdpgr lmaws using ivreg, bdec(3) rdec(3) keep (nd_firms medMB medInv lgdpgr lmaws) tex append label

ivregress gmm nd_firms medMB medInv lgdpgr i.ayear (lmaws =ldtbill ldrate3 lmedMB lmedInv llgdpgr)
outreg2 nd_firms medMB medInv lgdpgr lmaws using ivreg, bdec(3) rdec(3) keep (nd_firms medMB medInv lgdpgr lmaws) tex append label

ivregress gmm nud_firms medMB medInv lgdpgr i.ayear (lmaws =ldtbill ldrate3 lmedMB lmedInv llgdpgr)
outreg2 nd_firms medMB medInv lgdpgr lmaws using ivreg, bdec(3) rdec(3) keep (nd_firms medMB medInv lgdpgr lmaws) tex append label


***************************
** Tables 7 and 8 Competition Laws
***************************
clear 
clear matrix
set mem 2000m
set more off

sysdir set PLUS "C:\ado\plus"
global	curr "YOUR DIRECTORY"
cd "$curr"

use "$curr\VXDATA", clear


replace nIPO=. if nIPO<2

drop n_deals n_unique_deals vc_wave
*drop n_deals n_unique_deals
rename n_deals2 n_deals
rename n_deals3 n_unique_deals
rename vc_wave1 vc_wave

sort Company_Nation sic2 year 
by Company_Nation sic2: gen ln_deals = n_deals[_n-1]
by Company_Nation sic2: gen lTotal_Deal_Value =  Total_Deal_Value[_n-1]
by Company_Nation sic2: gen ln_MA_SDC =  n_MA_SDC[_n-1]
by Company_Nation sic2: gen ltotal_value_SDC =  total_value_SDC[_n-1]
by Company_Nation sic2: gen lu_deals =  n_unique_deals[_n-1]
by Company_Nation sic2: gen lmedInv =  medInv[_n-1]
by Company_Nation sic2: gen lmedMB =  medMB[_n-1]
by Company_Nation sic2: gen ltotalCAPEX =  totalCAPEX[_n-1]
by Company_Nation sic2: gen lvc_wave =  vc_wave[_n-1]
by Company_Nation sic2: gen lma_wave =  ma_wave[_n-1]
by Company_Nation sic2: gen lfvc_wave =  fvc_wave[_n-1]
by Company_Nation sic2: gen lfma_wave =  fma_wave[_n-1]

by Company_Nation sic2: gen lnIPO = nIPO[_n-1]
by Company_Nation sic2: gen lipo_wave =  ipo_wave[_n-1]

* percentage change in # of deals in an industry
g d_nIPO=(nIPO-lnIPO)/lnIPO
g d_ndeals=(n_deals-ln_deals)/ln_deals
* percentage change in # of unique deals in an industry
g d_nudeals=(n_unique_deals-lu_deals)/lu_deals

* percentage change in total deal value, but deal value is often missing
g d_Total_Deal_Value=(Total_Deal_Value-lTotal_Deal_Value)/lTotal_Deal_Value

* percentage change in # of MA deals in an industry
g d_n_MA_SDC=(n_MA_SDC-ln_MA_SDC)/ln_MA_SDC

* percentage change in total value of MA deals in an industry, also sometimes missing
g d_total_value_SDC=(total_value_SDC-ltotal_value_SDC)/ltotal_value_SDC

sort Company_Nation sic2 year 
by Company_Nation sic2: gen ld_ndeals = d_ndeals[_n-1]
by Company_Nation sic2: gen ld_nudeals = d_nudeals[_n-1]
by Company_Nation sic2: gen ld_n_MA_SDC = d_n_MA_SDC[_n-1]
by Company_Nation sic2: gen ld_nIPO = d_nIPO[_n-1]

g one=1
bysort Company_Nation year: egen medRD = median(RD_SALE)
bysort Company_Nation year: egen p75RD = pctile(RD_SALE), p(75)
bysort Company_Nation year: egen p25RD = pctile(RD_SALE), p(25)
bysort Company_Nation year: egen p90RD = pctile(RD_SALE), p(90)

drop if n_deals1<3
drop if n_MA_SDC<3
drop if n_deals1==.
drop if n_MA_SDC==.

g RDxn_deals=RD_SALE*n_deals
g RDxn_MA_SDC=RD_SALE*n_MA_SDC
g nd_sales=n_deals/totalSALE
g nd_salesMA=n_MA_SDC/totalSALE
g RDxnd_sales=RD_SALE*nd_sales
g RDxnd_salesMA=RD_SALE*nd_salesMA
g nd_firms=n_deals/nobsWS
g nud_firms=n_unique_deals/nobsWS
g nd_firmsMA=n_MA_SDC/nobsWS
g RDxnd_firms=RD_SALE*nd_firms
g RDxnud_firms=RD_SALE*nud_firms
g RDxnd_firmsMA=RD_SALE*nd_firmsMA
g RDxd_ndeals=RD_SALE*d_ndeals
g RDxd_n_MA_SDC=RD_SALE*d_n_MA_SDC
g RDxld_n_MA_SDC=RD_SALE*ld_n_MA_SDC
g logdeals=log(n_deals)
g logudeals=log(n_unique_deals)
g logMA=log(n_MA_SDC)
g laglogMA=log(ln_MA_SDC)
g RDxlogMA=RD_SALE*logMA
g RDxlaglogMA=RD_SALE*laglogMA
g sizei=log(totalSALE)
g logRD=log(totalRD)
g logRDxlogMA=logRD*logMA
g logRDxlaglogMA=logRD*laglogMA
g logCAPEX=log(totalCAPEX)
g laglogCAPEX=log(ltotalCAPEX)
g nd_firmsIPO=nIPO/nobsWS


**** lagged 3 year average M&A *****

sort Company_Nation sic2 year 
by Company_Nation sic2: gen d_n_MA_SDC3yr = (n_MA_SDC[_n-1]-n_MA_SDC[_n-3])/n_MA_SDC[_n-3]
by Company_Nation sic2: gen logMA3yr = (logMA[_n-1]+logMA[_n-2]+logMA[_n-3])/3

label var d_n_MA_SDC3yr "lagged 3 year % change in MA deals"
label var logMA3yr "lagged 3 year average log MA deals"

g RDxd_n_MA_SDC3yr=RD_SALE*d_n_MA_SDC3yr
g logRDxlogMA3r=RD_SALE*logMA3yr
label var RDxd_n_MA_SDC3yr "Interaction R&D and lagged 3 year MA growth"
label var logRDxlogMA3r "Interaction R&D and lagged 3 year average log MA deals"


sort Company_Nation sic2 year 
by Company_Nation sic2: gen lnd_firms = nd_firms[_n-1]
by Company_Nation sic2: gen lnud_firms = nud_firms[_n-1]
by Company_Nation sic2: gen lnd_firmsMA = nd_firmsMA[_n-1]
by Company_Nation sic2: gen lnd_firmsIPO = nd_firmsIPO[_n-1]
by Company_Nation sic2: gen lnd_sales = nd_sales[_n-1]
by Company_Nation sic2: gen lnd_salesMA = nd_salesMA[_n-1]

g RDxlnd_firmsMA=RD_SALE*lnd_firmsMA
g RDxlnd_salesMA=RD_SALE*lnd_salesMA


set more off


label var d_ndeals "% change in VC deals"
label var ld_ndeals "% change in VC deals (t-1)"
label var d_n_MA_SDC "% change in MA deals"
label var ld_n_MA_SDC "% change in MA deals (t-1)"
label var d_nIPO "% change in IPOs "
label var ld_nIPO "% change in IPOs (t-1)"

label var RD_SALE "Industry RD/Sales"
label var RDxd_n_MA_SDC "Interaction RD_SALE and d_n_MA_SDC"
label var RDxld_n_MA_SDC "Interaction R&D and lagged MA growth"
label var d_nudeals "% change in unique VC deals"
label var ld_nudeals "% change in unique VC deals (t-1)"

label var sizei "log of industry sales"
label var logRD "log of industry R&D"
label var logMA "log of takeover deals"
label var laglogMA "lagged log of takeover deals"

label var logRDxlogMA "interaction log(RD) log(MA)"
label var logRDxlaglogMA "interaction log(RD) lagged logMA"

label var nd_firms "Scaled VC deals"
label var lnd_firms "# VC deals / # WS firms (t-1)"
label var nud_firms "Scaled unique VC deals "
label var lnud_firms "# unique VC deals / # WS firms (t-1)"
label var nd_firmsMA "# M&A deals / # WS firms"
label var lnd_firmsMA "# M&A deals / # WS firms (t-1)"
label var nd_firmsIPO "# IPO deals / # WS firms"
label var lnd_firmsIPO "# IPO deals / # WS firms (t-1)"


label var medInv "Industry Capex/TA"
label var lmedInv "Industry Capex/TA (t-1)"
label var medMB "Industry Market-to-Book"
label var lmedMB "Industry Market-to-Book (t-1)"
label var logCAPEX "log of industry capex"

encode Company_Nation, gen(CN)
g Country_Ind = CN*100+sic2

sort Company_Nation sic2 year 
save temp, replace

use hhi, clear

g one=1
sort Company_Nation year 
*bysort Company_Nation sic2 year: egen medsize = median(size)
bysort Company_Nation year: egen numobs = sum(one)
drop if numobs<3
drop if salehhi==.

collapse (median) medhhi=salehhi, by(Company_Nation year)
drop if missing(Company_Nation)==1
sort Company_Nation year 
save temp2, replace

use  hhi, clear
sort Company_Nation year 
merge Company_Nation year using temp2
drop _merge
sort Company_Nation sic2 year 
save temp3, replace


use temp, clear
sort Company_Nation sic2 year 
merge Company_Nation sic2 year using temp3

drop if _merge==2

sort Company_Nation sic2 year 
by Company_Nation sic2: gen ltahhi = tahhi[_n-1]
by Company_Nation sic2: gen lsalehhi = salehhi[_n-1]
by Company_Nation sic2: gen lnobsWS = nobsWS[_n-1]

sort Company_Nation year 
save temp, replace

global	curr1 "G:\back_up\My_papers\New thoughts\International_takeovers\2015\2019"
use "$curr1\Data_CLI_190302", clear

replace country="United States" if country=="United States of America" 

rename country Company_Nation
sort Company_Nation year 
by Company_Nation: gen lcli_overall_norm = cli_overall_norm[_n-1]
by Company_Nation: gen lcli_mergers_norm = cli_mergers_norm[_n-1]
by Company_Nation: gen lcli_anticomp_norm = cli_anticomp_norm[_n-1]
by Company_Nation: gen lcli_overall_norm_eu = cli_overall_norm_eu[_n-1]
by Company_Nation: gen lpca_single = pca_single[_n-1]

sort Company_Nation year 
save temp1, replace

use temp, clear
drop _merge
merge Company_Nation year using temp1
drop if _merge==2

g lcli_overall_normxhhi=lsalehhi*lcli_overall_norm
g lpca_singlexhhi=lsalehhi*lpca_single
g lcli_overall_norm_euxhhi=lsalehhi*lcli_overall_norm_eu
g lcli_mergers_normxhhi=lsalehhi*lcli_mergers_norm
g lcli_anticomp_normxhhi=lsalehhi*lcli_anticomp_norm

***************************************************************
* using lagged 1 year M&A - looks like need to keep this
****************************************************************

**** table 3 *******

label var lcli_mergers_norm "CLI mergers"

cd "G:\back_up\My_papers\New thoughts\International_takeovers\2015\2019"
save "$curr\temp", replace

xi: reg d_ndeals lcli_mergers_norm   i.year, cluster(Country_Ind)
outreg2 d_ndeals lcli_mergers_norm   using myreg2, bdec(3) rdec(3) keep (d_ndeals lcli_mergers_norm lmedInv lmedMB) tex replace label

xi: reg d_ndeals lcli_mergers_norm lmedInv  i.year, cluster(Country_Ind)
outreg2 d_ndeals lcli_mergers_norm lmedInv  using myreg2, bdec(3) rdec(3) keep (d_ndeals lcli_mergers_norm lmedInv lmedMB) tex append label

xi: reg d_ndeals lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_ndeals lcli_mergers_norm lmedInv lmedMB   cli using myreg2, bdec(3) rdec(3) keep (d_ndeals lcli_mergers_norm lmedInv lmedMB) tex append label

xi: reg d_nudeals lcli_mergers_norm   i.year, cluster(Country_Ind)
outreg2 d_nudeals lcli_mergers_norm   using myreg2, bdec(3) rdec(3) keep (d_nudeals lcli_mergers_norm lmedInv lmedMB) tex append label

xi: reg d_nudeals lcli_mergers_norm lmedInv  i.year, cluster(Country_Ind)
outreg2 d_nudeals lcli_mergers_norm lmedInv  using myreg2, bdec(3) rdec(3) keep (d_nudeals lcli_mergers_norm lmedInv lmedMB) tex append label

xi: reg d_nudeals lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_nudeals lcli_mergers_norm lmedInv lmedMB   cli using myreg2, bdec(3) rdec(3) keep (d_nudeals lcli_mergers_norm lmedInv lmedMB) tex append label



xi: reg nd_firms lcli_mergers_norm  i.year, cluster(Country_Ind)
outreg2 nd_firms lcli_mergers_norm   cli using myreg3, bdec(3) rdec(3) keep (nd_firms lcli_mergers_norm ) tex replace label

xi: reg nd_firms lcli_mergers_norm lmedInv  i.year, cluster(Country_Ind)
outreg2 nd_firms lcli_mergers_norm lmedInv    cli using myreg3, bdec(3) rdec(3) keep (nd_firms lcli_mergers_norm lmedInv ) tex append label

xi: reg nd_firms lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 nd_firms lcli_mergers_norm lmedInv lmedMB   cli using myreg3, bdec(3) rdec(3) keep (nd_firms lcli_mergers_norm lmedInv lmedMB) tex append label

xi: reg nud_firms lcli_mergers_norm  i.year, cluster(Country_Ind)
outreg2 nud_firms lcli_mergers_norm   cli using myreg3, bdec(3) rdec(3) keep (nud_firms lcli_mergers_norm ) tex append label

xi: reg nud_firms lcli_mergers_norm lmedInv  i.year, cluster(Country_Ind)
outreg2 nud_firms lcli_mergers_norm lmedInv    cli using myreg3, bdec(3) rdec(3) keep (nud_firms lcli_mergers_norm lmedInv ) tex append label

xi: reg nud_firms lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 nud_firms lcli_mergers_norm lmedInv lmedMB   cli using myreg3, bdec(3) rdec(3) keep (nud_firms lcli_mergers_norm lmedInv lmedMB) tex append label


use "$curr\temp", clear

drop if salehhi>=medhhi
drop if medhhi==.

xi: reg nd_firms lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 nd_firms lcli_mergers_norm lmedInv lmedMB   cli using myreg4, bdec(3) rdec(3) keep (nd_firms lcli_mergers_norm lmedInv lmedMB) tex replace label

xi: reg nud_firms lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 nud_firms lcli_mergers_norm lmedInv lmedMB   cli using myreg4, bdec(3) rdec(3) keep (nud_firms lcli_mergers_norm lmedInv lmedMB) tex append label

use "$curr\temp", clear

drop if salehhi<medhhi
drop if medhhi==.

xi: reg nd_firms lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 nd_firms lcli_mergers_norm lmedInv lmedMB   cli using myreg4, bdec(3) rdec(3) keep (nd_firms lcli_mergers_norm lmedInv lmedMB) tex append label

xi: reg nud_firms lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 nud_firms lcli_mergers_norm lmedInv lmedMB   cli using myreg4, bdec(3) rdec(3) keep (nud_firms lcli_mergers_norm lmedInv lmedMB) tex append label

use "$curr\temp", clear

drop if salehhi>=medhhi
drop if medhhi==.

xi: reg d_ndeals lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_ndeals lcli_mergers_norm lmedInv lmedMB   cli using myreg5, bdec(3) rdec(3) keep (d_ndeals lcli_mergers_norm lmedInv lmedMB) tex replace label

xi: reg d_nudeals lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_nudeals lcli_mergers_norm lmedInv lmedMB   cli using myreg5, bdec(3) rdec(3) keep (d_nudeals lcli_mergers_norm lmedInv lmedMB) tex append label

use "$curr\temp", clear

drop if salehhi<medhhi
drop if medhhi==.

xi: reg d_ndeals lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_ndeals lcli_mergers_norm lmedInv lmedMB   cli using myreg5, bdec(3) rdec(3) keep (d_ndeals lcli_mergers_norm lmedInv lmedMB) tex append label

xi: reg d_nudeals lcli_mergers_norm lmedInv lmedMB i.year, cluster(Country_Ind)
outreg2 d_nudeals lcli_mergers_norm lmedInv lmedMB   cli using myreg5, bdec(3) rdec(3) keep (d_nudeals lcli_mergers_norm lmedInv lmedMB) tex append label


***************************
** Tables 10 pro-takeover laws
***************************


clear 
clear matrix
set mem 2000m
set more off

global	curr "F:\back_up\My_papers\New thoughts\International_takeovers\2015\STATA"
cd "F:\back_up\My_papers\New thoughts\International_takeovers\2015\STATA"
*log using sample2, replace	

use "$curr\countriesWS1", clear
sort Company_Nation
save countriesWS1, replace

use "$curr\temp", clear
sort Company_Nation 
merge Company_Nation using countriesWS1

replace tyear=2002 if Company_Nation=="Germany"
replace tyear=1997 if Company_Nation=="India"
replace tyear=2004 if Company_Nation=="Switzerland"
replace tyear=1998 if Company_Nation=="Austria"
replace tyear=2001 if Company_Nation=="New Zealand"

g timelaw=year-tyear
save temp1, replace


*** find median industry size *****;

global	curr1 "F:\back_up\My_papers\New thoughts\International_takeovers\2015\STATA"
use "$curr1\ws_comp_firm2020", clear

rename y year
g size=log(rev1)
g one=1
sort Company_Nation sic2 year 

bysort Company_Nation sic2 year: egen numobs = sum(one)
drop if numobs<3

collapse (median) medsize=size, by(Company_Nation sic2 year)
drop if missing(Company_Nation)==1
sort Company_Nation sic2 year 
save temp2, replace

use temp1, replace
sort Company_Nation sic2 year 
drop _merge
merge Company_Nation sic2 year using temp2
drop _merge
sort Company_Nation sic2 year 
merge Company_Nation sic2 year using hhi2020

drop if _merge==2

g postlaw=0
g prelaw=0
g prelawt1=0
g prelawt2=0
g prelawt3=0

replace postlaw=1 if timelaw>0 & timelaw<100

replace prelawt1=1 if timelaw==-1 
replace prelawt2=1 if timelaw==-2 
replace prelawt3=1 if timelaw==-3
 
g postlawxRD_SALE=postlaw*RD_SALE
g conc=log(nobsWS)

sort Company_Nation sic2 year 
by Company_Nation sic2: gen lRD_SALE = RD_SALE[_n-1]

by Company_Nation sic2: gen lmedsize = medsize[_n-1]

by Company_Nation sic2: gen ltahhi = tahhi[_n-1]
by Company_Nation sic2: gen lsalehhi = salehhi[_n-1]
by Company_Nation sic2: gen lconc = conc[_n-1]
by Company_Nation sic2: gen lnobsWS = nobsWS[_n-1]

g postlawxlRD_SALE=postlaw*lRD_SALE
g postlawxmedsize=postlaw*medsize
g postlawxlmedsize=postlaw*lmedsize
g postlawxsalehhi=postlaw*salehhi
g postlawxtahhi=postlaw*tahhi

g postlawxlsalehhi=postlaw*lsalehhi
g postlawxltahhi=postlaw*ltahhi

g postlawxconc=postlaw*conc
g postlawxlconc=postlaw*lconc

label var postlawxmedsize "Inter postlaw and medium size"
label var postlawxlmedsize "Inter postlaw and lagged medium size"
label var medsize "Medium industry size"
label var lmedsize "Lagged medium industry size"
label var postlaw "Postlaw dummy"
label var lsalehhi "Lagged sales HHI"
label var ltahhi "Lagged total assets HHI"
label var lconc "Lagged log # public firms in WS"
 
reghdfe nd_firms postlaw,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms postlaw using myreg5, bdec(3) rdec(3) keep(nd_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize) tex replace label

reghdfe nd_firms postlaw  lmedInv lmedMB lmedsize,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms postlaw  lmedInv lmedMB lmedsize using myreg5, bdec(3) rdec(3) keep(nd_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize) tex  append label

reghdfe nd_firms postlaw  lsalehhi lmedInv lmedMB lmedsize,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms postlaw  lsalehhi lmedInv lmedMB lmedsize using myreg5, bdec(3) rdec(3) keep(nd_firms postlaw  lsalehhi lmedInv lmedMB lmedsize) tex  append label

reghdfe nd_firms postlaw prelawt1 prelawt2,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms postlaw prelawt1 prelawt2 using myreg5, bdec(3) rdec(3) keep(nd_firms postlaw prelawt1 prelawt2) tex   append label

reghdfe nd_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize using myreg5, bdec(3) rdec(3) keep(nd_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize) tex  append label

reghdfe nd_firms postlaw prelawt1 prelawt2 lsalehhi lmedInv lmedMB lmedsize ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nd_firms postlaw prelawt1 prelawt2 lsalehhi lmedInv lmedMB lmedsize using myreg5, bdec(3) rdec(3) keep(nd_firms postlaw prelawt1 prelawt2 lsalehhi lmedInv lmedMB lmedsize)  tex append label



reghdfe nud_firms postlaw  ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms postlaw using myreg5u, bdec(3) rdec(3) keep(nud_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize) tex replace label

reghdfe nud_firms postlaw  lmedInv lmedMB lmedsize ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms postlaw  lmedInv lmedMB lmedsize using myreg5u, bdec(3) rdec(3) keep(nud_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize) tex append label

reghdfe nud_firms postlaw  lsalehhi lmedInv lmedMB lmedsize ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms postlaw  lsalehhi lmedInv lmedMB lmedsize using myreg5u, bdec(3) rdec(3) keep(nud_firms postlaw  lsalehhi lmedInv lmedMB lmedsize) tex append label

reghdfe nud_firms postlaw prelawt1 prelawt2 ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms postlaw prelawt1 prelawt2 using myreg5u, bdec(3) rdec(3) keep(nud_firms postlaw prelawt1 prelawt2)  tex append label

reghdfe nud_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize using myreg5u, bdec(3) rdec(3) keep(nud_firms postlaw prelawt1 prelawt2 lmedInv lmedMB lmedsize) tex append label

reghdfe nud_firms postlaw prelawt1 prelawt2 lsalehhi lmedInv lmedMB lmedsize ,  absorb(Country_Ind year) vce (cluster Country_Ind)
outreg2 nud_firms postlaw prelawt1 prelawt2 lsalehhi lmedInv lmedMB lmedsize using myreg5u, bdec(3) rdec(3) keep(nud_firms postlaw prelawt1 prelawt2 lsalehhi lmedInv lmedMB lmedsize) tex  append label




